DOORS ImportRTF function

I am attempting to import RTF files into a DOORS (v8.3) module (v8.3) using a DXL script, but the manual line feeds I want within an object are not being imported correctly. When I import using the File->Import->Rich Text File menu selection, it works properly. I have 405 files to import into a module, so doing it manually is not really an option (and the files are split out that way for a reason, so combining them is not a solution, either). I have posted my DXL script below:
string strCurDir = currentDirectory
string filename = strCurDir "\\SRDREV.LIS"
print "Reading from " filename "\n"
// Loads the contents of SRDREV.LIS into a stream for parsing.
Stream input = read filename
string str // do rest line by line
while (true) {
input >> str // read a line at a
// time
if (end of input) break //If the end of the file, then end.
string strRtfDocName = strCurDir "\\" str //concatinates the name with the path
importRTF(strRtfDocName, (current Module), true, true) // Imports into the current module
}
close input

--Brandon
bphegstr - Mon Aug 02 12:06:33 EDT 2010

Re: DOORS ImportRTF function
Mathias Mamsch - Tue Aug 10 16:37:00 EDT 2010

The RTF import script is not encrypted. You can find it under dxl/standard/import/rtfim.dxl.

Looking at it, I see it does a huge amount of preprocessing before really writing the RTF to the object. You not doing preprocessing is probably the reason why you get different results.

Without knowing the reason for the newline failures I suggest you a different solution. Automate the RTF import script! This can be done the following way:
 

// redeclare show to just do a realize! 
 
DB diag = null
 
void show(DB x) {
   realize x
   diag = x
}
 
string files[] = {"C:\\File1.txt", "C:\\File2.txt"}
 
for i in 0:1 do {
 
#include <standard/import/rtfim.dxl>
 
// we can do something with the dialog now! 
// Set the filename to what we want!
 
set (impFileName, files[i])
 
impFileImportCB(diag)
 
hide diag
 
}

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: DOORS ImportRTF function
jpain - Thu Aug 12 13:56:28 EDT 2010

I'm trying to achieve the same thing, only with each RTF imported as its own discrete module. I've tried running the above code (with a dummy rtf file in in the list for the files[] variable) and I get an error from the importif.inc script. "Null module parameter was passed into argument position 1." Not really sure how to approach this.

Is there another, preexisting way to mass import rtf files? I'd be surprised if bghegstr and myself were the first ones to try.

Re: DOORS ImportRTF function
Mathias Mamsch - Fri Aug 13 15:49:01 EDT 2010

jpain - Thu Aug 12 13:56:28 EDT 2010
I'm trying to achieve the same thing, only with each RTF imported as its own discrete module. I've tried running the above code (with a dummy rtf file in in the list for the files[] variable) and I get an error from the importif.inc script. "Null module parameter was passed into argument position 1." Not really sure how to approach this.

Is there another, preexisting way to mass import rtf files? I'd be surprised if bghegstr and myself were the first ones to try.

The above script will import the files into the current Module. You get the "null module" error, because you probably did not run the script from a module. To make it import into several modules, you will need to create a module in the loop, open it, and then call the import script. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: DOORS ImportRTF function
Giancarlo.Sellers - Fri Nov 26 05:42:02 EST 2010

Mathias Mamsch wrote:
The above script will import the files into the current Module. You get the "null module" error, because you probably did not run the script from a module. To make it import into several modules, you will need to create a module in the loop, open it, and then call the import script. Regards, Mathias

<hr>
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Now I got it, Thanks for your explanation! This is what I'm looking for.

Re: DOORS ImportRTF function
SystemAdmin - Fri Nov 26 07:37:50 EST 2010

Giancarlo.Sellers - Fri Nov 26 05:42:02 EST 2010

Mathias Mamsch wrote:
The above script will import the files into the current Module. You get the "null module" error, because you probably did not run the script from a module. To make it import into several modules, you will need to create a module in the loop, open it, and then call the import script. Regards, Mathias

<hr>
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Now I got it, Thanks for your explanation! This is what I'm looking for.

I used this script a few times (run DXL on multiple modules). Maybe it helps too.

http://www.smartdxl.com/downloads/dxltools16.html

Re: DOORS ImportRTF function
KBSri - Fri Mar 14 07:49:25 EDT 2014

SystemAdmin - Fri Nov 26 07:37:50 EST 2010
I used this script a few times (run DXL on multiple modules). Maybe it helps too.

http://www.smartdxl.com/downloads/dxltools16.html

I ran the script in the link it has great GUI to select different modules.

On the IMportRTF Function part: I made changes and ran the script it worked brilliantly to run in the particular module. It may help!


pragma runLim,0

//#include <standard/import/rtfim.dxl>
Module mod = current

string strCurDir = currentDirectory

string strRtfDocName = strCurDir "\\sample.rtf"
importRTF(strRtfDocName, mod, true, true) // Imports into the current module

print "Success!!\n"
infoBox "Success!! Importing successful"